﻿using PetaPoco;
using PmSoft;
using PmSoft.Caching;
using System.ComponentModel;

namespace Modules.Cms.Entitys
{
    /// <summary>
    /// 客户租赁管理
    /// </summary>
    [TableName("cms_custom_lease")]
    [Description("客户租赁管理")]
    [PrimaryKey("id", AutoIncrement = false)]
    [CacheSetting(true,PropertyNamesOfArea = "DealerId")]
    [Serializable]
    public class CmsCustomLease:IDelEntity
    {

        /// <summary>
        /// 主键
        /// </summary>
        [Column("id")]
        public int Id { get; set; }

        /// <summary>
        /// 创建人ID
        /// </summary>
        [Column("create_user_id")]
        public int CreateUserId { get; set; }

        /// <summary>
        /// 创建人名称
        /// </summary>
        [Column("create_user_name")]
        public string CreateUserName { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>
        [Column("create_dt")]
        public DateTime CreateDt { get; set; }

        /// <summary>
        /// 更新人ID
        /// </summary>
        [Column("update_user_id")]
        public int? UpdateUserId { get; set; }

        /// <summary>
        /// 更新人名称
        /// </summary>
        [Column("update_user_name")]
        public string? UpdateUserName { get; set; }

        /// <summary>
        /// 更新时间
        /// </summary>
        [Column("update_dt")]
        public DateTime? UpdateDt { get; set; }

        /// <summary>
        /// 删除标识
        /// </summary>
        [Column("is_deleted")]
        public bool IsDeleted { get; set; }
        /// <summary>
        /// 客户id
        /// </summary>
        [Column("custom_id")]
        public int CustomId { get; set; }

        /// <summary>
        /// 开始租赁日期
        /// </summary>
        [Column("start_dt")]
        public DateTime StartDt { get; set; }

        /// <summary>
        /// 结束租赁日期
        /// </summary>
        [Column("end_dt")]
        public DateTime EndDt { get; set; }

        /// <summary>
        /// 支付金额
        /// </summary>
        [Column("pay_amount")]
        public decimal PayAmount { get; set; }

        /// <summary>
        /// 当前状态;10 租赁中  20 已退租
        /// </summary>
        [Column("status")]
        public int Status { get; set; }

        /// <summary>
        /// 退租日期
        /// </summary>
        [Column("return_dt")]
        public DateTime? ReturnDt { get; set; }

        /// <summary>
        /// 退租金额
        /// </summary>
        [Column("return_amount")]
        public decimal? ReturnAmount { get; set; }

        /// <summary>
        /// 退租所属经销商
        /// </summary>
        [Column("dealer_id")]
        public int? DealerId { get; set; }
        /// <summary>
        /// 送货地址
        /// </summary>
        [Column("address")]
        public string Address {  get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        [Column("remark")]
        public string Remark { get; set; }


        [Ignore]
        bool IDelEntity.IsDeletedInDatabase { get => IsDeleted; set => IsDeleted = value; }

        #region IEntity 成员

        [Ignore]
        object IEntity.EntityId { get { return this.Id; } }

        #endregion IEntity 成员
    }
}
